package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Deliverydetails {
    private int detaId;//id
    private Integer detaProductid;//产品id
    private Double detaPrice;//产品售价
    private Integer detaNumber;//数量
    private Deliveryplan deliveryplanByDeliveryId;//交付计划id
   /* private Collection<Zproductside> productsidesByDetaId;*/
    private  Deliveryplan deliveryplan;
    private Integer detaReturnumber;//deta_returnumber

    @Id
    @Column(name = "deta_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getDetaId() {
        return detaId;
    }

    public void setDetaId(int detaId) {
        this.detaId = detaId;
    }

    @Basic
    @Column(name = "deta_productid")
    public Integer getDetaProductid() {
        return detaProductid;
    }

    public void setDetaProductid(Integer detaProductid) {
        this.detaProductid = detaProductid;
    }

    @Basic
    @Column(name = "deta_price")
    public Double getDetaPrice() {
        return detaPrice;
    }

    public void setDetaPrice(Double detaPrice) {
        this.detaPrice = detaPrice;
    }

    @Basic
    @Column(name = "deta_number")
    public Integer getDetaNumber() {
        return detaNumber;
    }

    public void setDetaNumber(Integer detaNumber) {
        this.detaNumber = detaNumber;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Deliverydetails that = (Deliverydetails) o;
        return detaId == that.detaId &&
                Objects.equals(detaProductid, that.detaProductid) &&
                Objects.equals(detaPrice, that.detaPrice) &&
                Objects.equals(detaNumber, that.detaNumber);
    }

    @Override
    public int hashCode() {
        return Objects.hash(detaId, detaProductid, detaPrice, detaNumber);
    }

    /*@ManyToOne
    @JoinColumn(name = "delivery_id", referencedColumnName = "delivery_id")
    public Deliveryplan getDeliveryplanByDeliveryId() {
        return deliveryplanByDeliveryId;
    }

    public void setDeliveryplanByDeliveryId(Deliveryplan deliveryplanByDeliveryId) {
        this.deliveryplanByDeliveryId = deliveryplanByDeliveryId;
    }*/

    @ManyToOne
    @JoinColumn(name = "delivery_id", referencedColumnName = "delivery_id")
    public Deliveryplan getDeliveryplan() {
        return deliveryplan;
    }

    public void setDeliveryplan(Deliveryplan deliveryplan) {
        this.deliveryplan = deliveryplan;
    }




  /*  @OneToMany
    public Collection<Zproductside> getProductsidesByDetaId() {
        return productsidesByDetaId;
    }

    public void setProductsidesByDetaId(Collection<Zproductside> productsidesByDetaId) {
        this.productsidesByDetaId = productsidesByDetaId;
    }*/



    @Basic
    @Column(name = "deta_returnumber")
    public Integer getDetaReturnumber() {
        return detaReturnumber;
    }

    public void setDetaReturnumber(Integer detaReturnumber) {
        this.detaReturnumber = detaReturnumber;
    }
}
